var api = require("../../utils/api.js");
Page({
  data: {
    breakContractEmail: "",
    breakContractPhone: ""
  },
  onLoad: function (options) {
    api.client.getBreakContractReceivingMeans(function (res) {}, this);
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {},

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  },
  emailInput(e) {
    this.setData({
      breakContractEmail: e.detail.value
    });
  },
  phoneInput(e) {
    this.setData({
      breakContractPhone: e.detail.value
    });
  },
  submit() {
    if (this.data.breakContractEmail == null || this.data.breakContractEmail == "") {
      wx.showToast({
        title: "电子邮件不能为空",
        icon: 'none',
        duration: 2000
      });
    } else if (this.data.breakContractPhone == null || this.data.breakContractPhone == "") {
      wx.showToast({
        title: "手机号不能为空",
        icon: 'none',
        duration: 2000
      });
    } else {
      api.client.modifyContractLiableUserBreakContract(function (res) {}, this.data.breakContractEmail, this.data.breakContractPhone, this);
    }
  }
})